package com.utils.view.widget;

import android.graphics.Point;

import com.google.gson.annotations.SerializedName;

import java.io.Serializable;

/**
 * @author sunfusheng on 2018/6/19.
 */
public class ImageData implements Serializable {

    @SerializedName(value = "imgUrl")
    private String url;

    private String videoUrl;

    private String text;
    private int drawableImg;
    @SerializedName(value = "width")
    private int realWidth;
    @SerializedName(value = "height")
    private int realHeight;

    private int startX;
    private int startY;
    @SerializedName(value = "realWidth")
    private int width;
    @SerializedName(value = "realHeight")
    private int height;

    public ImageData(String url) {
        this.url = url;
    }

    public ImageData() {

    }

    public ImageData from(ImageData imageData, LayoutHelper layoutHelper, int position) {
        if (imageData != null && layoutHelper != null) {
            Point coordinate = layoutHelper.getCoordinate(position);
            if (coordinate != null) {
                imageData.startX = coordinate.x;
                imageData.startY = coordinate.y;
            }

            Point size = layoutHelper.getSize(position);
            if (size != null) {
                imageData.width = size.x;
                imageData.height = size.y;
            }
        }
        return imageData;
    }

    public String getVideoUrl() {
        return videoUrl;
    }

    public void setVideoUrl(String videoUrl) {
        this.videoUrl = videoUrl;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public int getDrawableImg() {
        return drawableImg;
    }

    public void setDrawableImg(int drawableImg) {
        this.drawableImg = drawableImg;
    }

    public int getRealWidth() {
        return realWidth;
    }

    public void setRealWidth(int realWidth) {
        this.realWidth = realWidth;
    }

    public int getRealHeight() {
        return realHeight;
    }

    public void setRealHeight(int realHeight) {
        this.realHeight = realHeight;
    }

    public int getStartX() {
        return startX;
    }

    public void setStartX(int startX) {
        this.startX = startX;
    }

    public int getStartY() {
        return startY;
    }

    public void setStartY(int startY) {
        this.startY = startY;
    }

    public int getWidth() {
        return width;
    }

    public void setWidth(int width) {
        this.width = width;
    }

    public int getHeight() {
        return height;
    }

    public void setHeight(int height) {
        this.height = height;
    }
}
